<?php
	include('../../config/config.php');
	$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.constant('appid').'&secret='.constant('secret');
	$html = file_get_contents($url);
	$jsonObj = json_decode($html);
	$access_token = $jsonObj->access_token;
	$expires_in = $jsonObj->expires_in;
	$Getdata = array('access_token'=>$access_token,'expires_in'=>$expires_in+time());
	$html = json_encode($Getdata);
	$myfile = fopen("accessToken.data", "w") or die("Unable to open file!");
	fwrite($myfile, $html);
	fclose($myfile);
	echo $html;
?>